package Eyjafjalla.relic;

import Eyjafjalla.action.DrawCloudAction;
import Eyjafjalla.action.DrawToCloudAction;
import Eyjafjalla.action.MarkFireAfterDrawAction;
import Eyjafjalla.helper.StringHelper;
import basemod.abstracts.CustomRelic;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.helpers.ImageMaster;
import com.megacrit.cardcrawl.relics.AbstractRelic;

public class CloudInPacket extends CustomRelic {

    public static final String ID = "eyjafjalla:CloudInPacket";

    public CloudInPacket(){
        super(ID, ImageMaster.loadImage(StringHelper.getRelicIMGPATH(ID,false)),ImageMaster.loadImage(StringHelper.getRelicIMGPATH(ID,true)),RelicTier.BOSS,LandingSound.MAGICAL);
    }

    @Override
    public void atTurnStartPostDraw() {
        this.flash();
        this.addToBot(new RelicAboveCreatureAction(AbstractDungeon.player, this));
        this.addToBot(new DrawCloudAction(1,new MarkFireAfterDrawAction(true),true));
    }

    @Override
    public void obtain() {
        updateDescription(AbstractDungeon.player.chosenClass);
        if(AbstractDungeon.player.hasRelic(CloudInBottle.ID)){
            for(int i =0;i<AbstractDungeon.player.relics.size();i++){
                if((AbstractDungeon.player.relics.get(i)).relicId.equals(CloudInBottle.ID)){
                    this.instantObtain(AbstractDungeon.player,i,true);
                    break;
                }
            }
        }
        else{
            super.obtain();
        }
    }

    @Override
    public String getUpdatedDescription() {
        return DESCRIPTIONS[0];
    }

    @Override
    public AbstractRelic makeCopy() {
        return new CloudInPacket();
    }
}



